var app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    objarr: [],
    page: 1,
    pagesize: 10,
    totalpage: 0,//最大页数
    height: 0,
    nomore: true,
    del: false,
    totalfee:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var self = this;
    wx.getSystemInfo({
      success: function (res) {
        console.log(res);
        self.setData({ height: res.windowHeight })
      }
    })
    this.getData()

  },


  //滑动到底部 上拉加载
  scrollBottom: function () {
    this.data.page++
    if (this.data.page > this.data.totalpage) {
      this.setData({
        nomore: false
      })
    } else {
      let params = {
        page: this.data.page,
        pagesize: this.data.pagesize,
      }
      app.ajax("money_record", params, (data, err) => {
        let arr = this.data.objarr;
        for (let item of data.data.list) {
          arr.push(item);
        }
        this.setData({
          objarr: arr
        })
      })


    }

  },
  getData(){
    let params = {
      page: this.data.page,
      pagesize: this.data.pagesize
    }
    app.ajax("money_record", params, (data, err) => {
      this.setData({
        objarr: data.data.list,
        totalpage: data.data.total_page,
        totalfee: data.data.total_fee
      })
    })
  },
  
  txsq(){
    // app.ajax("apply_draw", { fee: this.data.totalfee}, (data, err) => {
    // })
    wx.navigateTo({
      url: '/pages/money/tx',
    })
  },

  totxlist(){
    wx.navigateTo({
      url: '/pages/money/txlist',
    })
  },
  totxgz(){
    wx.navigateTo({
      url: '/pages/money/txgz',
    })
  }
})